package demo_0421;

public class Main {
    public static void main(String[] args) {
        MyCountThread myCountThread = new MyCountThread();
        myCountThread.setName("张三");
        myCountThread.start();

        MyCountRunnable myCountRunnable = new MyCountRunnable();
        Thread thread = new Thread(myCountRunnable);
        thread.setName("李四");
        thread.start();

        MyCountRunnable myCountRunnable1 = new MyCountRunnable();
        Thread thread1 = new Thread(myCountRunnable);
        thread1.setName("王五");
        thread1.start();


        Thread.currentThread().setName("牢大");
        for (int i = 0; i <= 10; i++) {
            System.out.println(Thread.currentThread().getName() + " " + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
